<template>
	<view class="container">
		<view class="btn" @click="setCount()">点击预览</view>
		<video id="video1" :controls="isControls" src="http://192.168.0.193:8383/v.mp4"></video>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				isControls: false,
			}
		},
		onLoad(options) {
			console.log(options)
		},
		methods: {
			playVideo() {
				this.isControls = true; // 显示控制器
				const videoContext = uni.createVideoContext('video1', this);
				// console.log(JSON.stringify(videoContext))
				videoContext.play(); // 播放视频
			},
			setCount() {

				uni.downloadFile({
					url: 'http://192.168.0.193:8383/N.docx',
					success: function(res) {
						console.log(res)
						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							showMenu: false,
							success: function(res) {
								console.log('打开文档成功');
							},
							fail: function(err) {
								console.log(err)
							}
						});
						console.log(filePath)

					},
					fail: function(err) {
						console.log(err, 3)

					}
				});
			},

		}
	}
</script>

<style lang="scss">
	.container {
		padding-top: 130rpx;
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;

		.btn {
			margin: 20rpx;
			padding: 10rpx;
			text-align: center;
			background-color: royalblue;
			color: white;
			border-radius: 16rpx;
		}

		.dataResult {
			display: flex;
			flex-direction: column;
			padding: 20rpx;
			color: #555;
			word-wrap: break-word;
		}
	}

	.form-row {
		padding-top: 16rpx;
		padding-bottom: 16rpx;
		padding-left: 16rpx;
		padding-right: 16rpx;
		display: flex;
		flex-direction: row;
		align-items: center;

		.form-key {
			display: inline-block;
			text-align: justify;
			text-justify: distribute-all-lines;
			text-align-last: justify;
			color: #2f2f2f;
			font-size: 28rpx;
			font-weight: 600;
		}

		.form-value {
			padding-left: 16rpx;

			.radio {
				padding: 10rpx 40rpx;
			}
		}
	}

	.msg {
		display: flex;
		word-break: break-all;
	}
</style>